<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>应用类型定义</title>
</head>
<script type="text/javascript">
$(function(){
	$.post("ApplicationTypeDefinition/querydefinition",querydefinition,"json");
});
/* 动态获取卡应用类型名称 */
$(function(){
	$.get("openstop/Card",function(data){
		var content="<option value='' selected>请选择</option>";
		var i;
		$(data).each(function(n,item){
			for(i=0;i<item.sdd.length;i++){
				content+="<option value="+item.sdd[i].appKindId+">"
				+item.sdd[i].appKindName+"</option>"
			}
			$("#name").html(content);
		});
	},"json");
}); 
//拼接数据库中数据显示在html页面是
function querydefinition(json){
	var content="";
 	var numPerPage=json.numPerPage;
	var currentPage=json.currentPage;
	var totalCount=json.totalCount;
	var pageCount=json.pageCount;  
	// 没有数据
	if (json.list.length == 0) {
		 content+="<tr><td colspan='4' align='center' >未查询到数据</td></tr>";
	}
	$(json.list).each(function (index, item) {
		  content+="<tr onmouseover='moveoverMouse(this)' onmouseout='moveoutMouse(this)' align='center'><td width='2%'><input name='ids' onclick='test(this)'  type='checkbox'></td><td width='15%'>"+item.appKindCode+
         "</a></td><td width='10%'>"+item.appKindName+"</td><td width='10%'>"+item.accountFlag+"</td><td width='10%'>"+item.isWriteCard+
        "</td><td width='10%'>"+item.allowDisable+"</td><td width='10%'>"+item.validMonthNum+
        "</td><td width='10%'>"+item.isAnnual+
        "</td><td width='15%'>"+item.isOnline+"</td></tr>"
	});

	
	$("#zy").html(content);
	 $("input[name='numPerPage']").val(numPerPage);
	$("input[name='currentPage']").val(currentPage); 
	 $("input[name='pageCount']").val(pageCount);
	 $("input[name='totalCount']").val(totalCount);
	 $("#totalCountByApplicationTypeDefinition").text("条，共"+totalCount+"条");
	     	$("div.pagination").each(function(){
		var $this = $(this);
		$this.pagination({
			targetType:"navTab",
			rel:"zy",
			totalCount:totalCount,
			numPerPage:numPerPage,
			pageNumShown:10,
			currentPage:currentPage,
			callback:querydefinition
		});
	});
	      return true;
 }
//去修改页面
function updateApp(){
	
	if($("input[name='ids']:checked").length < 1){
		 alertMsg.warn("您未选择数据！")
		 return false;
	}
	
	if($("input[name='ids']:checked").length > 1){
		 alertMsg.warn("不能选择多于1条数据！")
		 return false;
	}
	 var param;
	 $("input[name='zy']:checked").each(function(n,item){
		 param=$(this).val();
	 })
	var options={"width":"500","height":"500","param":param};
	$.pdialog.open("ApplicationTypeDefinition/UpdateAppName","infos", "修改类型定义",options);
	
}

/* 全选/反选 */
var isCheckAll = false;
function Check() {
	if (isCheckAll) {
		$("input[type='checkbox']").each(function() {
			this.checked = false;
		});
		isCheckAll = false;
	} else {
		$("input[type='checkbox']").each(function() {
			this.checked = true;
		});
		isCheckAll = true;
	}
}


</script>
<body>

<div class="pageHeader ">
<form id="zhuanyi" method="post"  action="ApplicationTypeDefinition/querydefinition"class="pageForm required-validate" onsubmit="return validateCallback(this,querydefinition);">
         <input type="hidden" name="currentPage" value="" /> 
		<input type="hidden" name="numPerPage" value="" />
		<input type="hidden" name="pageCount" value="" />
 <div class="pageFormContent" >

	<p>
							<label>卡应用类型名称：</label>
							<select id="name" name="appKindName" class="required">
							<option  class="required" value="50">请选择</option>
			                </select>
						</P>
			<div class="formBar"   >
				<ul> 
				<li>
				<div class="buttonActive" ><div class="buttonContent" ><button type="submit" title="查询" >查询</button></div></div>
				</li>
				</ul>
				</div>
		
					<!--  <div class="panelBar">
		                  <ul class="toolBar">
			<li><a class="add" href="ApplicationTypeDefinition/addAppName" target="dialog" rel="addAppName" width="700" height="500"><span title="添加">新增</span></a></li>
			<li><a  id="edit"  class="edit"  onclick="return updateApp();"><span title=修改>修改</span></a></li>
		</ul>
	</div> -->
</div>
					
</form>	
				
				</div>

						<form id="yi" method="post" action="" class="pageForm required-OpenApp" onsubmit="return validateCallback(this,navTabAjaxDone);">
						<div class="pageContent" >
						<table class="table" width="100%" layoutH="238">
						<thead>
						<tr align="center">
						<th width="2%"><input type="checkbox" id="ids" name="" group="zy" onclick="Check()" ></th>
						<th width="15%" >应用类型代码</th>
						<th width="10%" >应用类型名称</th>
						<th width="10%" name="status" id="app" >是否有后台账户</th>
						<th width="10%" >是否写卡</th>
						<th width="10%">是否可停用</th>
						<th width="10%" >有效月数</th>
						<th width="10%">是否需年检</th>
						<th width="15%">是否联机应用</th>
						</tr>
						</thead>
						<tbody id="zy">
						</tbody>
						</table>
						</div>
						</form>
	<div class="panelBar">
		<div class="pages">
			<span>显示</span>
			<select id="numPerPageByReissueCard" name="numPerPage" onchange="paging(this,$('#zy'),zy)">
				<option value="20">20</option>
				<option value="30">30</option>
				<option value="50">50</option>
				<option value="100">100</option>
			</select>
			<span id="totalCountByApplicationTypeDefinition" >条，共${totalCount}条</span>
		</div>
		<div callback='querydefinition' id="paginationByApplicationTypeDefinition" rel="zy" class="pagination" targetType="navTab" totalCount="200" numPerPage="5" pageNumShown="5" currentPage="1"></div>

		</div>
</body>
</html>